Synchronize Model to Database

The Synchronize Model to Database feature allows you to compare a model with an existing database or schema, states the differences between their structures, and offers synchronizing the structures in model to the target connection.

Navicat Data Modeler provides a step-by-step wizard for you to complete the task:

Choose Connections

The first step is to define the source model and the target connection.

Choose Comparing Options

Then, click the Options button to select the compare / advanced options for the synchronization process.

Note: The following options depend on the diagram database type you are chosen and sort in ascending order.

Option

Description

Compare auto increment value

Compare the auto increment values of tables.

Compare character set

Compare the character sets of tables.

Compare checks

Compare check constraints.

Compare collation

Compare the collations of tables.

Compare definers

Compare the definers of views.

Compare excludes

Compare exclusion constraints.

Compare foreign keys

Compare the foreign keys of tables.

Compare functions

Compare function and procedure objects.

Compare identity last value

Compare the identity last values of tables.

Compare indexes

Compare table indexes.

Compare owners

Compare the owners of database objects.

Compare partitions

Compare table partitions.

Compare primary keys

Compare the primary keys of tables.

Compare rules

Compare rule objects.

Compare sequences

Compare sequence objects.

Compare sequence last values

Compare the last values of sequences.

Compare storage

Compare table storages.

Compare table options

Compare other table options.

Compare tables

Compare table objects.

Compare triggers

Compare table triggers.

Compare uniques

Compare unique constraints.

Compare views

Compare view objects.

Drop with CASCADE

Drop the dependent database objects with the CASCADE option.

Identifier Case Sensitivity

Ignore or consider the case of identifiers when mapping, or use the server default setting.

Start Comparison

Click the Compare button to compare the source model and the target database.

View Comparison Results

After comparing structures, the tree view shows the differences between the source and target databases or schemas. Check the objects you want to apply to the target. You can expand the objects to view the detailed structure.

You can choose to group the objects in the tree views by object types or operations by selecting Group by Object Type or Group by Operation.

Operation

Description

Modify

Object exists in both source and target databases/schemas, but they have different definition. The target object will be modified based on the source object.

Create

Object does not exist in the target database/schema. It will be created in the target.

Delete

Object does not exist in the source database/schema. The target object will be deleted.

No Operation

Object exists in both source and target databases/schemas and they have identical definition. No operation will be applied.

When you select an object from the comparison results, the DDL Comparison tab displays the statements for that object from both the source model and the target database side by side. Any differences in the statements, such as added, modified, or removed fields, are highlighted for quick identification.

Furthermore, the Deployment Script tab shows the specific scripts that will be executed on the target database to apply the selected changes.

Click the Next button to show the scripts of all selected objects.

Edit & Execute Selected Scripts

You can view all scripts that will be executed in the target database in the Deployment Script tab.

Deployment Options Button

Description

Deployment Options

Continue on error - Ignore errors that are encountered during the execution process if necessary.
Include deployment query in message log - Show the deployment queries in the Message Log tab during execution.

Edit Script

Open the Edit Deployment Script window to rearrange the order of the scripts.

Copy Script to Clipboard

Copy all scripts from the Deployment Script tab to the clipboard.

In the Edit Deployment Script window, use the arrow buttons to move the scripts.

Then, click the Start button to execute the scripts. The window will display the execution progress, execution time, and success or failure messages.